< previous page page_659 next page >

Page 659
0659-01.jpg
Figure 29.16
The Crystal Reports control
is invisible while your program
is running; reports are viewed
in an independent window.
However, for the sample report, setting the ReportFileName property at designtime is sufficient. To do so, right-click the control and select Properties to display the Property Pages dialog box. On the General tab, shown in Figure 29.17, you can specify the location of the RPT file. You can also choose whether the report should go to the printer, a preview window, a file, or to an e-mail message.
0659-02.jpg
Figure 29.17
On the Property Pages dialog
box, you can specify the report
file and output destination.
Selecting the ReportFileName is the minimum setup for Crystal Reports. At this point, you can write the single line of code necessary to run the report and test it by running your program.
Setting Optional Properties
Although only the ReportFileName is required for a report, you might want to use several optional properties with the report. The first of these properties is the SelectionFormula property. This property enables you to limit the number of records that are included in the report. The SelectionFormula property is similar to the Where clause of a SQL statement but uses its own particular format to enter the information. (This format is the same as that described in the earlier section "Customizing Your Report.") The following is an example of setting this property from code:
CrystalReport1.SelectionFormula = "{Authors.Year Born} >= 1955"
You also can use multiple expressions by including the And or Or operators.
CAUTION
If you enter a SelectionFormula when you're designing your report, any formula you enter in the SelectionFormula property of the Crystal Reports control provides an additional filter on the records.

 
< previous page page_659 next page >